﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<HsTec.DigitalPlatform.Model.DTO.PlayerModel>" %>
<% using (Html.BeginForm("Add", "Player", FormMethod.Post, new { id = "ediform" }))
   {%>
<table border="0">
    <tr style="display: none;">
        <td>
            流水号:
        </td>
        <td>
            <%=Html.TextBoxFor(t => t.playerid)%>
        </td>
    </tr>
    <tr>
        <td>
            运动员号:
        </td>
        <td>
            <%=Html.TextBoxFor(t => t.playnumber)%>
        </td>
    </tr>
    <tr>
        <td>
            学号:
        </td>
        <td>
            <%=Html.TextBoxFor(t => t.playeno)%>
        </td>
    </tr>
    <tr>
        <td>
            姓名:
        </td>
        <td>
            <%=Html.TextBoxFor(t => t.playername)%>
        </td>
    </tr>
    <tr style="display: none;">
        <td>
            密码:
        </td>
        <td>
            <%=Html.TextBoxFor(t => t.password)%>
        </td>
    </tr>
    <tr>
        <td>
            年级:
        </td>
        <td>
            <%=Html.DropDownListFor(t => t.grade, Model.gradelist, "请选择...", new { @style = "width:150px" })%>
        </td>
    </tr>
    <tr>
        <td>
            专业:
        </td>
        <td>
            <%=Html.DropDownListFor(t => t.specid, Model.speclist, "请选择...", new { @style = "width:150px" })%>
        </td>
    </tr>
    <tr>
        <td>
            班级:
        </td>
        <td>
            <%=Html.DropDownListFor(t => t.classid, Model.classlist, "请选择...", new { @style = "width:150px" })%>
        </td>
    </tr>
    <tr>
        <td>
            性别:
        </td>
        <td>
            <%=Html.DropDownListFor(t => t.sex, Model.sexlist, "请选择...", new { @style = "width:150px" })%>
        </td>
    </tr>
    <tr>
        <td>
            手机:
        </td>
        <td>
            <%=Html.TextBoxFor(t => t.tel)%>
        </td>
    </tr>
    <tr style="display: none;">
        <td colspan="2">
            <input type="submit" id="btnSave" />
        </td>
    </tr>
</table>

<script type="text/javascript" language="javascript">
    $(document).ready(function() {
        $('#grade').change(function() {
            getClass("playerspec");
        });
        $('#specid').change(function() {
            getClass("playerspec");
        });
    });
    function getClass(obj) {
        $.ajaxSetup({ cache: false });
        var selectedItem = $("#" + obj).val();
        if (selectedItem == "" || selectedItem == 0) {
            $("#classid").html("");
            $("#classid").attr('disabled', "disabled");
        } else {
            var sltspecid = $("#specid > option:selected").attr("value");
            var sltgrade = $("#grade > option:selected").attr("value");
            $.ajax({
                type: "post",
                dataType: "json",
                url: '<%=Url.Action("GetClassInfo")%>',
                data: { "specid": sltspecid, "gradeid": sltgrade },
                success: function(data) {
                    var items = "";
                    if (data == null)
                        return;
                    $.each(data, function(i, data) {
                        items += "<option value='" + data.id + "'>" + data.name + "</option>";
                    });
                    $("#classid").html(items);
                    $("#classid").removeAttr('disabled');
                }
            });
        }
    }
</script>

<%} %>